package com.aspose.cells;

import java.util.HashMap;

class zafj {
   private PageSetup b;
   private Workbook c;
   private Worksheet d;
   private HashMap e;
   private boolean f;
   zatl a;
   private zadm g;
   private zadj h;
   private double i;
   private double j;
   private com.aspose.cells.a.d.ze k;
   private zbmg l;

   zafj(Workbook var1, zatl var2, double var3, double var5, com.aspose.cells.a.d.ze var7, zbmg var8) {
      this.k = var7;
      this.l = var8;
      this.c = var1;
      this.e = new HashMap();
      this.a = var2;
      this.i = var3;
      this.j = var5;
   }

   void a(Worksheet var1, int var2, int var3, zasn var4) throws Exception {
      this.d = var1;
      this.b = this.d.getPageSetup();
      if (var1.getType() == 2) {
         this.b = this.d.getCharts().get(0).getPageSetup();
      }

      this.f = true;
      this.a(var2, var3, var4);
      this.f = false;
      this.a(var2, var3, var4);
   }

   private void a(int var1, int var2, zasn var3) throws Exception {
      String var4 = "";
      String var5 = "";
      String var6 = "";
      if (this.b.isHFDiffFirst() && var1 == 1) {
         if (this.f) {
            var4 = this.b.l(0);
            var5 = this.b.l(1);
            var6 = this.b.l(2);
         } else {
            var4 = this.b.k(0);
            var5 = this.b.k(1);
            var6 = this.b.k(2);
         }
      } else if (this.b.isHFDiffOddEven() && var1 % 2 == 0) {
         if (this.f) {
            var4 = this.b.i(0);
            var5 = this.b.i(1);
            var6 = this.b.i(2);
         } else {
            var4 = this.b.j(0);
            var5 = this.b.j(1);
            var6 = this.b.j(2);
         }
      } else if (this.f) {
         var4 = this.b.g(0);
         var5 = this.b.g(1);
         var6 = this.b.g(2);
      } else {
         var4 = this.b.h(0);
         var5 = this.b.h(1);
         var6 = this.b.h(2);
      }

      if (var4 != null && var4.length() >= 1) {
         this.a(var4, 7, var1, var2, var3);
      }

      if (var5 != null && var5.length() >= 1) {
         this.a(var5, 1, var1, var2, var3);
      }

      if (var6 != null && var6.length() >= 1) {
         this.a(var6, 8, var1, var2, var3);
      }

   }

   private void a(String var1, int var2, int var3, int var4, zasn var5) throws Exception {
      byte var7;
      if (this.f) {
         var7 = 9;
      } else {
         var7 = 0;
      }

      this.g = new zadm(this.a.a, var5, this.l, this.b, var2, var7, this.c, this.i, this.j, this.k);
      if (var1 != null) {
         this.h = new zadj(this.g, this.c.getWorksheets().get(var5.a), this.e, var3, var4, this.i, this.j);
         String[] var8 = new String[]{var1};
         boolean var9 = this.h.a(var8) == -1;
         String var6 = var8[0];
         if (var9) {
            throw new CellsException(19, "Such header or footer is not supported yet!");
         }
      }

      this.g.b();
   }
}
